package com.cefa.finance.dao;

import com.cefa.finance.model.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@SuppressWarnings("ALL")
@Repository
@Transactional
public interface UserRepository extends CrudRepository<User,Long> {

    @Query(value = "select * from cefa_finance_user where phone=?1", nativeQuery = true)
    User findUserByIdcode(String phone);

    @Query(value = "select * from cefa_finance_user where phone=?1", nativeQuery = true)
    User findUserByPhone(String phone);

    @Query(value = "select * from cefa_finance_user where block_status is not TRUE ", nativeQuery = true)
    List<User> findUnBlockedUsers();
}
